import { defineComponent } from 'vue';
import { SlateEditor } from 'slate-vue';

export default defineComponent({
  name: 'SlateWrapper',
  components: { SlateEditor },
  props: {
    value: {
      type: Array,
      required: true
    }
  },
  methods: {
    handleChange(value: any) {
      this.$emit('change', value);
    }
  },
  render() {
    return h(SlateEditor, {
      value: this.value,
      onChange: this.handleChange
    });
  }
});